.TH INIT 8 
.SH NAME
init, rc  \-  process control initialization
.SH SYNOPSIS
.B /etc/init
.br
.B /etc/rc
.SH DESCRIPTION
.I Init
is invoked as the last step of the boot procedure (see
.IR boot (8)).
Generally its role is to create a process for each
typewriter on which a user may log in.
.PP
When
.I init
first is executed
the console typewriter
.I /dev/console.
is opened for reading
and writing and the shell is invoked immediately.
This feature is used to bring up a single-user system.
If the shell terminates,
.I init
comes up multi-user and the process described below is started.
.PP
When
.I init
comes up multiuser,
it
invokes a shell, with input taken from the
file
.I /etc/rc.
This command file
performs housekeeping
like removing temporary files,
mounting file systems, and starting
daemons.
.PP
Then
.I init
reads the file
.I /etc/ttys
and
forks several times to create a process
for each typewriter specified in the file.
Each of these processes opens the appropriate typewriter
for reading and writing.  These channels thus
receive file descriptors 0, 1 and 2, the standard input,
output and error files.
Opening the typewriter will usually involve a delay,
since the
.IR open ""
is not completed until someone
is dialed up and carrier established on the channel.
Then
.I /etc/getty
is called with argument as specified by the last character of
the
.I ttys
file line.
.I Getty
reads the user's name and invokes
.IR login (1)
to log in the user and execute the shell.
.PP
Ultimately the shell will terminate
because of an end-of-file either
typed explicitly or generated as a result of hanging up.
The main path of
.IR init ,
which has been waiting
for such an event,
wakes up and removes the appropriate entry from the
file
.IR utmp ,
which records current users, and
makes an entry in
.IR /usr/adm/wtmp ,
which maintains a history
of logins and logouts.
Then the appropriate typewriter is reopened and
.I getty
is
reinvoked.
.PP
.I Init
catches the
hangup signal SIGHUP and interprets it to mean that
the
system should be brought from multi user to single
user.
Use `kill -1 1' to send the hangup signal.
.SH FILES
/dev/tty?, /etc/utmp, /usr/adm/wtmp, /etc/ttys, /etc/rc
.SH "SEE ALSO"
login(1), kill(1), sh(1), ttys(5), getty(8)
